package graphics;
import processing.core.PApplet;
import processing.core.PFont;

/**
 *
 * @author Jah Emanuel
 */
public class CheckerDisplay {

    private final int[] COLOR_KING={255,221,0};
    private PApplet parent;
    private float size;
    private float xpos;
    private float ypos;
    private boolean isBlack;
    private int[] color;
    private boolean isKing;

    public CheckerDisplay(PApplet parent, float size, float xpos, float ypos, boolean isBlack, boolean isKing) {
        this.parent = parent;
        this.size = size;
        this.xpos = xpos;
        this.ypos = ypos;
        this.isBlack = isBlack;
        this.isKing=isKing;
        color=new int[3];
        if(isBlack){
            color[0]=0;
            color[1]=0;
            color[2]=0;
        }else{
            color[0]=230;
            color[1]=0;
            color[2]=0;
        }
        this.display();
    }

    public boolean isBlack() {
        return isBlack;
    }

    public boolean isKing() {
        return isKing;
    }

    public void display() {
        parent.ellipseMode(PApplet.CORNER);
        parent.smooth();
        parent.stroke(87,87,87);
        parent.strokeWeight((int) (0.01 * size));
        parent.fill(color[0],color[1],color[2]);
        parent.ellipse(xpos,ypos,size,size);
        if(isKing){
            parent.fill(COLOR_KING[0],COLOR_KING[1],COLOR_KING[2]);
            parent.ellipse(xpos,ypos,size/3,size/3);
        }
    }
}
